<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>4-offsetWidth和offsetHeight</title>
		<style type="text/css">
			.box{
				width:1200px;
				height:100px;
				margin:0 auto;
				border:10px solid #0000FF;
				background:red;
				padding:10px 20px;
				/* 宽度:1200+6+40=1246 高度:126 */
			}
		</style>
	</head>
	<body>
		<div class="box" style="width:1200px;"></div>
		<script type="text/javascript">
			//offsetWidth-offsetHeight 包含了padding+border+盒子的宽高
			//获取元素对象
			var box = document.querySelector('.box');
			console.log(box.offsetWidth);//1200
			console.log(box.offsetHeight);//120
			//获取不了style样式表中设置的值
			console.log(box.style.width);//1200px
		</script>
	</body>
</html>
